package com.cta.view.model;

import org.joda.time.LocalDate;

public class DurationLock {

	private LocalDate from;
	private LocalDate to;
	private String tableName;

	public DurationLock(LocalDate from, LocalDate to, String tableName) {
		this.from = from;
		this.to = to;
		this.tableName = tableName;
	}

	public String lookup(LocalDate start) {
		//if still in
		if (from.compareTo(start) <= 0 && to.compareTo(start) >= 0) {
			return tableName;
		}
		return null;
	}

	public LocalDate getFrom() {
		return from;
	}

	public void setFrom(LocalDate from) {
		this.from = from;
	}

	public LocalDate getTo() {
		return to;
	}

	public void setTo(LocalDate to) {
		this.to = to;
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}
}
